<template>
  <div>
    <h1>我是home</h1>
    {{ moreStudents }}
    <hr />
    {{ $store.state.num }}
    <hr />
    <p>姓名：{{ info.name }}</p>
    <p>年龄：{{ info.age }}</p>
    <p>身高：{{ info.height }}</p>
    <p>体重：{{ info.weight }}</p>
    <button @click="addWeight">点击添加体重</button>
  </div>
</template>

<script>
export default {
  computed: {
    students() {
      return this.$store.state.students.filter((item) => item.age > 17);
    },
    moreStudents() {
      return this.$store.getters.moreAge(16);
    },
    info() {
      return this.$store.state.info;
    },
  },
  methods: {
    addWeight() {
      this.$store.commit(addWeight);
    },
  },
};
</script>

<style>
</style>